function UpdateOrAddTimeFrequencyFileInDatabase(filename, subject, channel, channelType, condition, frequencies, times, nrOfEpochs)
%UPDATEORADDTIMEFREQUENCYFILEINDATABASE(filename, subject, channel, condition, ...)

global Database;

cFilename = strcmp(Database.timefrequency_header, 'Filename');
cSubject = strcmp(Database.timefrequency_header, 'Subject');
cChannel = strcmp(Database.timefrequency_header, 'Channel');
cChannelType = strcmp(Database.timefrequency_header, 'ChannelType');
cCondition = strcmp(Database.timefrequency_header, 'Condition');
cFrequencies = strcmp(Database.timefrequency_header, 'Frequencies');
cTimes = strcmp(Database.timefrequency_header, 'Times');
cNrOfEpochs = strcmp(Database.timefrequency_header, 'NrOfEpochs');

rFilename = strcmp(Database.timefrequency(:, cFilename), filename);
if ~any(rFilename)
    Database.timefrequency{end+1, cFilename} = filename;
    rFilename = size(Database.timefrequency, 1);
end
Database.timefrequency{rFilename, cSubject} = subject;
Database.timefrequency{rFilename, cChannel} = channel;
Database.timefrequency{rFilename, cChannelType} = channelType;
Database.timefrequency{rFilename, cCondition} = condition;
Database.timefrequency{rFilename, cFrequencies} = frequencies;
Database.timefrequency{rFilename, cTimes} = times;
Database.timefrequency{rFilename, cNrOfEpochs} = nrOfEpochs;

SaveTable('timefrequency');
end

